Skip to content

Conversation

@JonathanC-ARM
Copy link
Contributor

Description

When compiling with micro-benchmark on Mac Mini M4 I encounter the following build failure

Build command

./build.sh --config Release --build_shared_lib --parallel --skip_tests --osx_arch arm64 --apple_deploy_target 14 --apple_sysroot macosx --build_micro_benchmarks --cmake_generator Ninja --cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON

System Information

-- The C compiler identification is AppleClang 17.0.0.17000013
-- The CXX compiler identification is AppleClang 17.0.0.17000013
-- The ASM compiler identification is AppleClang
Mac Mini M4
Os Version 15.4.1

Build Failure

[1487/1608] Building CXX object CMakeFiles/onnxruntime_benchmark.dir/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc.o
FAILED: [code=1] CMakeFiles/onnxruntime_benchmark.dir/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc.o
/usr/bin/c++ -DBENCHMARK_STATIC_DEFINE -DCPUINFO_SUPPORTED -DCPUINFO_SUPPORTED_PLATFORM=1 -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DONLY_C_LOCALE=0 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DONNX_USE_LITE_PROTO=1 -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_KLEIDIAI -D__ONNX_NO_DOC_STRINGS -I/Users/jonclo01/onnxruntime/include/onnxruntime -I/Users/jonclo01/onnxruntime/include/onnxruntime/core/session -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/pytorch_cpuinfo-src/include -I/Users/jonclo01/onnxruntime/build/MacOS/Release -I/Users/jonclo01/onnxruntime/onnxruntime -I/Users/jonclo01/onnxruntime/onnxruntime/core/mlas/inc -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/google_benchmark-src/include -I/Users/jonclo01/onnxruntime/onnxruntime/test/util/include -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/abseil_cpp-src -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/date-src/include -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/nlohmann_json-src/include -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/onnx-src -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/onnx-build -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/protobuf-src/src -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/re2-src -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/flatbuffers-src/include -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/eigen3-src -I/Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/kleidiai-src -isystem /Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/safeint-src -isystem /Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/gsl-src/include -isystem /Users/jonclo01/onnxruntime/build/MacOS/Release/_deps/mp11-src/include -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -std=gnu++20 -arch arm64 -fPIE -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-copy -Wno-tautological-pointer-compare -Wno-ambiguous-reversed-operator -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-undefined-var-template -Wno-deprecated-builtins -Wno-deprecated-literal-operator -Wshorten-64-to-32 -Wno-error=comment -Werror -MD -MT CMakeFiles/onnxruntime_benchmark.dir/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc.o -MF CMakeFiles/onnxruntime_benchmark.dir/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc.o.d -o CMakeFiles/onnxruntime_benchmark.dir/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc.o -c /Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc
/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc:38:10: error: variable 'sum' set but not used [-Werror,-Wunused-but-set-variable]
   38 |   size_t sum = 0;
      |          ^
/Users/jonclo01/onnxruntime/onnxruntime/test/onnx/microbenchmark/tptest.cc:105:48: error: increment of object of volatile-qualified type 'volatile size_t' (aka 'volatile unsigned long') is deprecated [-Werror,-Wdeprecated-volatile]
  105 |         for (volatile size_t x = 0; x < body; x++) {
      |                                                ^
2 errors generated.

Summary of Changes

  • C++ 20 is the standard CXX version as defined in CMakeLists.txt for Apple Devices. Incrementing of Volatile is no longer supported in this version, removed qualifier and added appropriate substitute.
  • Add [[ maybe_unused ]] to suppress unused variable warning for sum variable

Signed-off-by: Jonathan Clohessy <Jonathan.Clohessy@arm.com>
@hariharans29
Copy link
Member

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@hariharans29
Copy link
Member

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

Signed-off-by: Jonathan Clohessy <jonathan.clohessy@arm.com>
Signed-off-by: Jonathan Clohessy <jonathan.clohessy@arm.com>
@hariharans29
Copy link
Member

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@hariharans29 hariharans29 merged commit 6e67664 into microsoft:main Oct 24, 2025
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants